import time
from data015.Base.Base import Base
from selenium.webdriver.common.by import By
class Page(Base):
    # 定位登录
    login_01 = (By.CLASS_NAME,'headerLogin')
    # 点击登录
    def click_login(self):
        self.click(self.login_01)
    # 输入账号
    user= (By.ID,'userName')
    def username(self,):
        self.send_keys(self.user,'17518836160')
    # 输入密码
    word = (By.ID,'password')
    def password(self):
        self.send_keys(self.word,'123456Aa')
    # 点击登录按钮
    login_02= (By.ID,'save')
    def click_login02(self):
        self.click(self.login_02)
    # 点击确认      bindSub
    dj = (By.ID,'bindSub')
    def dj1(self):
        self.click(self.dj)

    # 输入框输入商品名称
    jiouname = (By.ID,'wd')
    def name01(self):
        self.send_keys(self.jiouname,'茅台')
    # 回车
    def hueiche(self):
        self.Enter(self.jiouname)
    # # 点击搜索
    # sousuo = (By.XPATH,'/html/body/div[3]/div/div[2]/div[1]/form/input[2]')
    # def susuo(self):
    #     self.click(self.sousuo)
    # 点击商品
    sp_click = (By.XPATH,'/html/body/div[6]/div/div[2]/div[5]/ul/li[7]/div[2]/div[1]/a/img')
    def shngpin(self):
        self.click(self.sp_click)
    # # 加入购物车
    # jiaru = (By.XPATH,'//*[@id="addToCartForDetail"]')
    # def jiaru01(self):
    #     self.click(self.jiaru)
    # # 点击查看购物车
    # dianji = (By.XPATH,'//*[@id="u-buy-layId"]/div/div[3]/a[2]')
    # def dianji01(self):
    #     self.click(self.dianji)

    def A3mall_execute_01(self):
        self.open_url('https://www.jiuxian.com/')
        self.click_login()   #点击登录
        time.sleep(1)
        self.username()   #输入账号
        time.sleep(1)
        self.password()   #输入密码
        time.sleep(7)
        self.click_login02()   #点击登录按钮
        self.dj1()
        time.sleep(3)
        self.name01()
        time.sleep(1)
        self.hueiche()
        time.sleep(1)
        self.shngpin()
        # self.jiaru01()
        # time.sleep(1)
        # self.dianji01()
        # time.sleep(3)





